import java.util.Scanner;
public class Colution {
    //字符串替换函数
    public String formatString (String str, char[] arg) {
        // write code here
        char[] s = str.toCharArray();
        //创建一个栈，将str放进栈,这里可以用StringBuilder 代替stack
        StringBuilder stack = new StringBuilder();
        int j = 0;
        for(int i = 0;i<s.length;i++){
            if(s[i]=='s'&&i-1>=0&&s[i-1]=='%'){
                //替换
                stack.deleteCharAt(stack.length()-1);
                stack.append(arg[j]);
                j++;
            }else{
                //进栈
                stack.append(s[i]);
            }
        }
        //补充剩余元素
        while(j<arg.length){
            stack.append(arg[j]);
            j++;
        }
        return stack.toString();
    }
        //检测是否是神奇数
        public static boolean check2(int num,boolean[] hash){
            int[] nums = new int[7];
            int i = 0;
            while(num>0){
                nums[i] = num%10;
                num/=10;
                i++;
            }
            for(int j = 0;j<nums.length-1;j++){
                for(int k = j+1;k<nums.length;k++){
                    int sum1 = nums[k]*10+nums[j];
                    int sum2 = nums[j]*10+nums[k];
                    if(hash[sum1]||hash[sum2]){
                        return true;
                    }
                }
            }
            return false;
        }
        //检测是否是质数
        public static boolean check1(int num){
            for(int i = 2;i<num;i++){
                if(num%i==0){
                    return false;
                }
            }
            return true;
        }
        public static void main1(String[] args) {
            Scanner in = new Scanner(System.in);
            int a = in.nextInt();
            int b = in.nextInt();
            int count = 0;
            //创建一个hash表存放两位数的质数
            boolean[] hash = new boolean[100];
            //hash表存放两位数的质数
            for(int i = 10;i<100;i++){
                if(check1(i)){
                    hash[i] = true;
                }
            }
            //
            for(int i = a;i<=b;i++){
                if(check2(i,hash)){
                    count++;
                }
            }
            System.out.println(count);
        }
    //压缩字符串
    public static String compressString (String param) {
        StringBuilder ret = new StringBuilder();//模拟栈
        char[] s = param.toCharArray();
        int count = 0;
        for(int i = 0;i<s.length;i++){

            if(ret.isEmpty()||ret.charAt(ret.length()-1)!=s[i] ){
                if(count>1){
                    ret.append(count);
                }
                count = 1;
                ret.append(s[i]);
            }else{
                count++;
            }
        }
        if(count>1) {
            ret.append(count);
        }
        return ret.toString();
    }

    public static long fun(long num1,long num2){
        long min = Math.min(num1,num2);
        if(min==1){
            return 1;
        }
        for(int i = 2;i<min;i++){
            if(num1%i==0&&num2%i==0){
                return i;
            }
        }
        return min;
    }
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();//怪物个数
        long x = in.nextInt();//初始战斗力
        long[] arr = new long[n];
        for(int i = 0;i<n;i++){
            arr[i] = in.nextInt();
        }

        for(int i = 0;i<n;i++){
            if(arr[i]<= x){
                x = x+arr[i];
            }else{
                x = x+fun(x,arr[i]);
            }
        }
       System.out.println(x);
    }
}
